package com.jfinal.model.auth;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Record;

import java.util.List;

/**
 * Created by xiaoyuan on 2018/1/19.
 */
public class Auth extends Model<Auth>{
    public static final Auth dao = new Auth().dao();
    private String findRolesByAuth = Db.getSql("auth.findRolesByAuth");

    /**
     * 获取拥有该权限的所有角色
     * @return
     */
    public List<Role> getRoles(){
        return Role.dao.find(findRolesByAuth,get("id"));
    }
}
